import {Card, Row, Col, List, Typography, Table, Tag} from "antd";
import Base from "@/pages/Province/SubjectDetail/components/Base";
import {FileWordOutlined} from "@ant-design/icons";
import {nanoid} from "@ant-design/pro-components";
import Pie from './components/Pie'
import {history} from "@@/core/history";
import {useEffect, useState} from "react";
import {Detail03Level, Detail03Teacher} from "@/services/Province/Dashboard";
import {ProvinceAllUrl} from "@/utils/format";
import {Link} from "@umijs/preset-dumi/lib/theme";

export default (props) => {

  const urlArr = history.location.pathname.split('/')
  const school = urlArr[urlArr.length - 1]
  const subject = urlArr[urlArr.length - 2]
  const schoolSubject = school + '-' + subject
  const [teacherGroupData, setteacherGroupData] = useState([])
  const [foreignLevelData, setforeignLevelData] = useState([])
  const [reload, setReload] = useState(false)
  useEffect(() => {
    Detail03Level({subject: schoolSubject}).then(res => {
      if (res.status === 0) {
        setforeignLevelData(res.data)
      }
    })
  }, [reload])

  const detailMap = {
    '高层次人才及团队': {
      fill_id: '3_2_2_0,3_2_2_1,3_2_2_2,3_2_2_3,3_2_2_4',
      url: ProvinceAllUrl(school, subject, '3_2_2_0,3_2_2_1,3_2_2_2,3_2_2_3,3_2_2_4', '高层次人才及团队')
    },
    '国家级团队和学术领军人才': {
      fill_id: '3_2_2_0,3_2_2_1,3_2_2_3,3_2_2_4',
      url: ProvinceAllUrl(school, subject, '3_2_2_0,3_2_2_1,3_2_2_3,3_2_2_4', '国家级团队和学术领军人才')
    },
    '省重点人才': {
      fill_id: '3_2_2_2,3_2_2_3',
      url: ProvinceAllUrl(school, subject, '3_2_2_2,3_2_2_3', '省重点人才')
    },
    '学科专任教师(最新学年度)': {
      fill_id: '3_2_3',
      url: ProvinceAllUrl(school, subject, '3_2_3', '学科专任教师(最新学年度)')
    },
    '博士后和科研助理(最新学年度)': {
      fill_id: '3_2_4',
      url: ProvinceAllUrl(school, subject, '3_2_4', '博士后和科研助理(最新学年度)')
    },
    '外籍专任教师数量(最新学年度)': {
      fill_id: '3_2_5',
      url: ProvinceAllUrl(school, subject, '3_2_5', '外籍专任教师数量(最新学年度)')
    },

    '担任国内外重要期刊负责人': {
      fill_id: '3_3_1',
      url: ProvinceAllUrl(school, subject, '3_3_1', '担任国内外重要期刊负责人')
    },
    '在国内重要学术组织任职': {
      fill_id: '3_3_2',
      url: ProvinceAllUrl(school, subject, '3_3_2', '在国内重要学术组织任职')
    },
    '参加本领域重要学术会议做报告人': {
      fill_id: '3_3_3',
      url: ProvinceAllUrl(school, subject, '3_3_3', '参加本领域重要学术会议做报告人')
    },
    '担任国际比赛负责人': {
      fill_id: '3_3_4',
      url: ProvinceAllUrl(school, subject, '3_3_4', '担任国际比赛负责人')
    },
  }

  return <Base props={props}>
    <Row gutter={[24, 24]}>
      <Col span={24}>
        <Card title="师资队伍国际水平">
          <Row gutter={24} justify="space-around" align="middle">
            <Col span={24}>
              <List
                header={<Typography.Text strong>师资队伍国际水平人数情况</Typography.Text>}
                bordered
                dataSource={foreignLevelData}
                renderItem={item => (
                  <List.Item>
                    <Typography.Text strong>{item.name}</Typography.Text>: <Tag color="blue">{item.value}人</Tag>
                    <Link to={detailMap[item.name] ? detailMap[item.name]['url'] : ''}>详情</Link>
                  </List.Item>
                )}
              />
            </Col>
            {/*<Col span={12}>*/}
            {/*  <Pie name="师资队伍国际水平人数占比情况"*/}
            {/*       data={foreignLevelData}*/}
            {/*       height="300px"*/}
            {/*  />*/}
            {/*</Col>*/}
          </Row>
        </Card>
      </Col>
    </Row>
  </Base>
}
